home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
DBTOOLC.LZH
/
SOURCE.ARC
/
PEEKPOKE.C
< prev
next >
Wrap
Text File
|
1986-07-11
|
2KB
|
94 lines
#include "intregs.h"
char pokebyte(byte,offset,segment)
char byte; /* byte to be poked into memory, max value of 256 */
unsigned offset,segment; /* address to be poked */
{
#ifndef LARGE
struct intregs regs;
#endif
#ifdef LARGE /* large data models */
segmov(1,&byte,offset,segment);
#else
gdosint(0,®s,®s); /* return register values with special 0 call */
segmov(1,&byte,regs.ds,offset,segment); /* move the byte */
#endif
return(0);
}
unsigned pokeword(word,offset,segment)
unsigned word; /* word to be poked into memory */
unsigned offset,segment; /* address to be poked */
{
#ifndef LARGE
struct intregs regs;
#endif
#ifdef LARGE /* large data models */
segmov(2,&word,offset,segment); /* move the word into tempvar */
#else
gdosint(0,®s,®s); /* return register values with special 0 call */
segmov(2,&word,regs.ds,offset,segment); /* move the word */
#endif
return(0);
}
char peekbyte(offset,segment)
unsigned offset,segment; /* address to be peeked */
{
#ifndef LARGE
struct intregs regs;
#endif
char tempvar;
#ifdef LARGE /* large data models */
segmov(1,offset,segment,&tempvar); /* move the byte into tempvar */
#else
gdosint(0,®s,®s); /* return register values with special 0 call */
segmov(1,offset,segment,&tempvar,regs.ds); /* move the byte */
#endif
return(tempvar);
}
unsigned peekword(offset,segment)
unsigned offset,segment; /* address to be peeked */
{
#ifndef LARGE
struct intregs regs;
#endif
unsigned tempvar;
#ifdef LARGE /* large data models */
segmov(2,offset,segment,&tempvar); /* move the byte into tempvar */
#else
gdosint(0,®s,®s); /* return register values with special 0 call */
segmov(2,offset,segment,&tempvar,regs.ds); /* move the byte */
#endif
return(tempvar);
}